	.global Cmain
	.global start
	.extern OSTickISR
	.extern tcbtmp
	
	.equ MSKIRQ, 0X80
	.equ SVCMODE, 0X13
	.equ IRQMODE, 0X12
	.code 32
	.text
	.align 2
start:
	B 	ResetHandle
	B 	UndefHandle
	B 	SwiHandle
	B 	PabtHandle
	B 	DataAbtHandle
	b	.
	B 	IrqHandle
	B 	FiqHandle  

ResetHandle:
	@intial irq stack
	MOV     R0,   #IRQMODE
	MSR     CPSR_c, R0
	LDR     SP,   =0X31ff0000

	@initial svc mode stack
	MOV     R0,   #SVCMODE
	MSR     CPSR_c, R0
	LDR     SP,   =0X310f0000

	ldr     pc,   =main
	
	
UndefHandle:
	B       UndefHandle
SwiHandle:
	B       SwiHandle
PabtHandle:
	B       PabtHandle
DataAbtHandle:
	B       DataAbtHandle
IrqHandle:
	SUB 	   LR,   LR,#4
	STMFD	  SP!, {R0-R12, LR}
 
	@@@@clear timer4 interrupt in s3c2440@@@@@@@@@@@@@
	LDR     R0,   =0X4A000000		@SRCPND
	LDR     R1,   [R0]
	ORR     R1,   #0x4000
	STR     R1,   [R0]
	LDR     R0,   =0X4A000010	@INTPND
	LDR     R1,   [R0]
	ORR     R1,   R1, #0x4000
	STR     R1,   [R0]	
	@@@@@@@@@@@@@@@@@@
	
	BL      OSTickISR
	
	@BL Led1Test
	@return from interrupt and force spsr write to cpsr
	@LDMFD	SP!, {R0-R12,PC}^
FiqHandle:
	B       FiqHandle

	.end
	
